
package com.google.earth.kml;

/** 
 * Schema fragment(s) for this class:
 * <pre>
 * &lt;xs:complexType xmlns:ns="http://earth.google.com/kml/2.1" xmlns:xs="http://www.w3.org/2001/XMLSchema" final="#all" name="BalloonStyleType">
 *   &lt;xs:complexContent>
 *     &lt;xs:extension base="ns:ObjectType">
 *       &lt;xs:sequence>
 *         &lt;xs:choice>
 *           &lt;xs:element type="xs:hexBinary" default="ffffffff" name="color" minOccurs="0"/>
 *           &lt;xs:element type="xs:hexBinary" default="ffffffff" name="bgColor" minOccurs="0"/>
 *         &lt;/xs:choice>
 *         &lt;xs:element type="xs:hexBinary" default="ff000000" name="textColor" minOccurs="0"/>
 *         &lt;xs:element type="xs:string" name="text" minOccurs="0"/>
 *       &lt;/xs:sequence>
 *     &lt;/xs:extension>
 *   &lt;/xs:complexContent>
 * &lt;/xs:complexType>
 * </pre>
 */
public class BalloonStyleType extends ObjectType
{
    private int choiceSelect = -1;
    private static final int COLOR_CHOICE = 0;
    private static final int BG_COLOR_CHOICE = 1;
    private byte[] color;
    private byte[] bgColor;
    private byte[] textColor;
    private String text;

    private void setChoiceSelect(int choice) {
        if (choiceSelect == -1) {
            choiceSelect = choice;
        } else if (choiceSelect != choice) {
            throw new IllegalStateException(
                    "Need to call clearChoiceSelect() before changing existing choice");
        }
    }

    /** 
     * Clear the choice selection.
     */
    public void clearChoiceSelect() {
        choiceSelect = -1;
    }

    /** 
     * Check if Color is current selection for choice.
     * 
     * @return <code>true</code> if selection, <code>false</code> if not
     */
    public boolean ifColor() {
        return choiceSelect == COLOR_CHOICE;
    }

    /** 
     * Get the 'color' element value.
     * 
     * @return value
     */
    public byte[] getColor() {
        return color;
    }

    /** 
     * Set the 'color' element value.
     * 
     * @param color
     */
    public void setColor(byte[] color) {
        setChoiceSelect(COLOR_CHOICE);
        this.color = color;
    }

    /** 
     * Check if BgColor is current selection for choice.
     * 
     * @return <code>true</code> if selection, <code>false</code> if not
     */
    public boolean ifBgColor() {
        return choiceSelect == BG_COLOR_CHOICE;
    }

    /** 
     * Get the 'bgColor' element value.
     * 
     * @return value
     */
    public byte[] getBgColor() {
        return bgColor;
    }

    /** 
     * Set the 'bgColor' element value.
     * 
     * @param bgColor
     */
    public void setBgColor(byte[] bgColor) {
        setChoiceSelect(BG_COLOR_CHOICE);
        this.bgColor = bgColor;
    }

    /** 
     * Get the 'textColor' element value.
     * 
     * @return value
     */
    public byte[] getTextColor() {
        return textColor;
    }

    /** 
     * Set the 'textColor' element value.
     * 
     * @param textColor
     */
    public void setTextColor(byte[] textColor) {
        this.textColor = textColor;
    }

    /** 
     * Get the 'text' element value.
     * 
     * @return value
     */
    public String getText() {
        return text;
    }

    /** 
     * Set the 'text' element value.
     * 
     * @param text
     */
    public void setText(String text) {
        this.text = text;
    }
}
